// @ts-ignore
import OSS from 'ali-oss'

const OSSParams = {
    region: 'oss-cn-beijing',
    accessKeyId: 'LTAI5t6DcTaSUFLSX6YwBGxx',
    accessKeySecret: 'eiUTDvGwCg11GR118njEXjIoSX2fi9',
    bucket: 'letter-post'
}
let client = new OSS(OSSParams);
export const uploadFile = async (file: File) => {
    let filename = new Date().getTime() + file.name
    let res = await client.put(filename, file)
    await client.putACL(filename, 'public-read');
    let url: string = res.url
    return url;
}
export default client;